package io.gimo.study.design_pattern.factory.factory_method.factory;


import io.gimo.study.design_pattern.factory.factory_method.Sender;
import io.gimo.study.design_pattern.factory.factory_method.product.MailSender;
import io.gimo.study.design_pattern.factory.factory_method.product.SmsSender;

/**
 * 发送器的工厂，用于生成邮件或者短信的发送器
 * @author GimoXie
 *
 */
public class SendFactory {

	public Sender produce(String type){
		if("mail".equals(type)){
			return new MailSender();
		}else if("sms".equals(type)){
			return new SmsSender();
		}else{
			System.out.println("请输入正确的类型!");  
			return null;
		}
	}
}
